package com.woniu.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.woniu.utils.BaseController;

@Controller

public class HomeController extends BaseController {

	// 当访问主页的时候跳转到paipai/admin/index
	@RequestMapping("/")
	public String showIndex() {
		return ("paipai/adminiframe/logins");
	}
	
	//管理员退出后台
	@RequestMapping("/adminlogout")
	public String adminLogout(HttpServletRequest req) {
		req.getSession().removeAttribute("adminsession");
		//如果不写下一步子页面会拦截失败，是因为父、子页面有两个session，
		//上面只清除了父界面session中的
		req.getSession().invalidate();
		return "paipai/adminiframe/logins";
	}
	
	//管理员退出后台
	@RequestMapping("/adminlogout1")
	public String adminLogout1(HttpSession session) {
		session.removeAttribute("adminsession");
		return "paipai/adminiframe/logins";
	}

	//管理员忘记密码
	@RequestMapping("/forget")
	public String showForget() {
		return ("paipai/adminiframe/forget");
	}
	
	//进入后台首页
	@RequestMapping("/iframe")
	public String showIframeIndex() {
		return ("paipai/adminiframe/index");
	}
	
	//进入后台首页
	@RequestMapping("/mainiframe")
	public String showmainIframeIndex() {
		return ("paipai/adminiframe/index_mainiframe");
	}
	
	@RequestMapping({ "/success", "/info" })
	public String success() {
		return "demo/success";
	}

}